#!/bin/bash

UNAME=`uname`

if [ "${UNAME}" = "Darwin" ]; then
    echo "Should run in Vagrant Linux. not Mac"
    exit 1
fi

INSTALL_HOME="/alidata1"
UPLOAD_HOME="/home/ftp-user"

OLD_DIR=`pwd`
cd $INSTALL_HOME
echo "cd $INSTALL_HOME"

# clean up
sudo rm -Rf ./hookfishusername.tar

# untar
echo "Untar..."
mv $UPLOAD_HOME/hookfishusername.tar ./
tar zxvf hookfishusername.tar

# Link to supervisor
echo "Link supervisor"
sudo ln -s $INSTALL_HOME/hookfishusername/hookfish.conf /etc/supervisor/conf.d/hookfishusername.conf


cd -
#The End
